﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;

/// <summary>
/// Summary description for cls_tbHOADON_KYHIEUHOADON
/// </summary>
public class cls_tbHOADON_KYHIEUHOADON
{
	public cls_tbHOADON_KYHIEUHOADON()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    #region select
    public static DataTable Get(string F_MACN)
    {
        DataTable dt = new DataTable();
        DatabaseConnect connect = new DatabaseConnect();
        SqlParameter[] para = new SqlParameter[1];

        para[0] = new SqlParameter("@F_MACN", F_MACN);
        try
        {
            dt = connect.GetSelectCommand("tbHOADON_KYHIEUHOADON_Get", para);
        }
        catch { }
        return dt;
    }
    public static DataTable GetAll()
    {
        DataTable dt = new DataTable();
        DatabaseConnect connect = new DatabaseConnect();
        //SqlParameter[] para = new SqlParameter[1];

        //para[0] = new SqlParameter("@F_MACN", F_MACN);
        try
        {
            dt = connect.GetSelectCommand("tbHOADON_KYHIEUHOADON_GetAll", null);
        }
        catch { }
        return dt;
    }
    #endregion
    #region Update
    public static string Update(int ID, string KYHIEUHOADON)
    {
        DatabaseConnect connect = new DatabaseConnect();
        // Tham so
        object[] values = { ID, KYHIEUHOADON };
        string[] parameters = { "@ID", "@KYHIEUHOADON" };

        SqlParameter[] para = new SqlParameter[parameters.Length];
        for (int i = 0; i < parameters.Length; i++)
        {
            para[i] = new SqlParameter(parameters[i], values[i]);
        }

        try
        {
            connect.ExecuteQuery("tbHOADON_KYHIEUHOADON_Update", para);
            return "OK";
        }
        catch
        {
            return "ERR";
        }
    }
    #endregion
}